package homework.oo3.AnimalExercise1;

public class RefArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("大黄",6,"黄");
        dogs[1] = new Dog("大紫",8,"紫");
        dogs[2] = new Dog("大磊",9,"灰");
        dogs[0].name = "大傻春";
        dogs[1].age = 88;
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }

        System.out.println("=========");
        Chick[] chicks = new Chick[2];
        chicks[0] = new Chick("七彩鸡",99,"彩");
        chicks[1] = new Chick("芦花",99,"花");
        for (int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].age);
            chicks[i].drink();
        }

        System.out.println("==========");
        Fish[] fish = new Fish[2];
        fish[0] = new Fish("金金",22,"金");
        fish[1] = new Fish("火火",33,"红");
        for (int i=0;i<fish.length;i++){
            System.out.println(fish[i].color);
            fish[i].swim();
        }
    }
}
